<div class="fly-panel fly-signin ">
    <div class="fly-panel-title ">
        {:isset($my_oj_coin)?'OJ币：<span id="my_oj_coin">'.$my_oj_coin.'</span>':'签到'}
        <i class="fly-mid "></i>
        <a href="javascript:; " class="fly-link " id="LAY_signinHelp">说明</a>
        <span class="fly-signin-days ">上次签到时间:<span id="last-sign-time"></span></span>
    </div>
    <div class="fly-panel-main fly-signin-main " id="bhxchdcbvdjsad" style='height: auto;'>
        {if condition="$sign_disable"}
        <div id="hitokoto-loader" style="position: relative;right: 160px;margin-bottom: 50px;">
            <i class="layui-icon layui-anim-rotate layui-anim-loop" style="color: black;float: right;font-size: 60px;">&#xe63d;</i>
        </div>
        <div id="hitokoto-content">
            
        </div>
        <br />
        <div id="hitokoto-from" style="text-align: right;">
            
        </div>
        {else /}
                <button  class="layui-btn layui-btn-normal" id="sign_in">今日签到</button>
        {/if}
    </div>
</div>
<script>
layui.use(['jquery', 'layer'], function() { //签到模块
    var $ = layui.jquery;
    var layer = layui.layer;
    $.ajax({
        url: '/api/get_last_sign_time',
        success: function(res) {
            $('#last-sign-time').html(res);
        }
    });
    $("#sign_in").click(function() {
        // console.log('sdsd');
        $.ajax({
            url: "/api/user_sign_in ",
            success: function(res) {
                layer.msg(res.msg);
                var num=$("#my_oj_coin").text();
                $("#my_oj_coin").text(parseInt(num)+1);
                $('#bhxchdcbvdjsad').html('<button  class="layui-btn layui-btn-danger layui-disabled" id="sign_in">已签到</button>');
            }
        });
    });
});

layui.use(['jquery'],function(){
    $=layui.jquery;
    $.ajax({
        type:"get",
        url:"http://open.iciba.com/dsapi",
        dataType:"jsonp",/*加上datatype*/
        success:function(data){
            if (typeof data === 'string') data = JSON.parse(data);
            console.log(data);
            $('#hitokoto-loader').remove();
            $('#hitokoto-content').text(data.content);
            $('#hitokoto-from').text('——' + data.note);
        }
    });
});

       
</script>